var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, f, g) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = g;
    var b = -1;
    if (status <= b++) {
        cm.dispose()
    } else {
        if (status === b++) {
            var a = cm.getNumberFromQuestInfo(64685, "point");
            var c = cm.getNumberFromQuestInfo(500830, "record");
            var j = Math.floor(a / 10);
            var h = "#b很棒的烟花秀！可以称得上是几乎完美了。\r\n\r\n#e获得分数: #n#b#e" + a + "分#n#k    #r#e";
            if (a > c) {
                cm.setNumberForQuestInfo(500830, "record", a);
                h += "(达成新纪录！)"
            }
            h += "#n#k\r\n";
            var e = cm.getStringFromQuestInfo(500830, "lastday");
            if (!e.equals(cm.getNowTimeString(3))) {
                h += "#L0# #b获得奖励。#k #e(日冕积分 " + j + "分)#n#l\r\n"
            }
            h += "#L1# #b重新挑战。#k#l\r\n#L2# #b返回原来所在地点。#k#l";
            cm.askMenu(h, 4, 9400963)
        } else {
            if (status === b++) {
                if (g == 1) {
                    cm.dispose();
                    cm.openNpc(9400963, "活动_日冕烟花秀");
                    return
                } else {
                    if (g == 2) {
                        cm.dispose();
                        cm.warp(867139000, 8);
                        return
                    }
                }
                cm.askYesNo("来，这是一点小小的心意。(※注意※#n#k #r#e每天在每个世界只能领取1次#n#k奖励。)", 4, 9400963)
            } else {
                if (status === b++) {
                    var a = cm.getNumberFromQuestInfo(64685, "point");
                    var c = cm.getNumberFromQuestInfo(500830, "record");
                    var j = Math.floor(a / 10);
                    var e = cm.getStringFromQuestInfo(500830, "lastday");
                    cm.setStringForQuestInfo(500830, "lastday", cm.getNowTimeString(3));
                    cm.setNumberForQuestInfo(64685, "point", 0);
                    cm.addNumberForQuestInfo(500828, "point", j);
                    cm.addNumberForQuestInfo(500828, "sum", j * 100);
                    cm.playerMessage(5, "获得了" + j + "分日冕积分。");
                    cm.dispose();
                    cm.warp(867139000, 8)
                }
            }
        }
    }
};